#ifndef _TWITTER_RESPONSE_H_
#define _TWITTER_RESPONSE_H_
#include "Error.h"

NS_BEGIN(Twit)

class response:public Error
{
protected:
   std::string m_source;
public:
   const std::string& source()
   {
      return m_source;
   }

   const bool set(const int code, const std::string& msg)
   {
	   Error::set(code, msg);

      switch(code)
      {
      case rc_ok: m_source = msg;
         break;
      case rc_twitter_error:
      case rc_parsing_error:
         break;
      default:
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
         m_source.erase(m_source.begin(), m_source.end());
#else
         m_source.clear();
#endif
         break;
      }
      return m_code==rc_ok;
   }
   
   inline const bool set(const int code, const char* msg)
   {
      return set(code, std::string(msg));
   }
   inline const bool set(const int code)
   {
      m_code = code;
      return bool();
   }
};

NS_END;
#endif /*_TWITTER_RESPONSE_H_*/
